package bookManager.operations;

import bookManager.Book;
import bookManager.BookDao;

import java.util.Scanner;

public class AddOperation implements IOperation {
    @Override
    public void work() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入新增图书的名字：");
        String name = scanner.next();
        System.out.println("请输入图书的作者：");
        String author = scanner.next();
        System.out.println("请输入图书的价格：");
        int price = scanner.nextInt();
        System.out.println("请输入图书的类型：");
        String type = scanner.next();

        Book book = new Book();
        book.setName(name);
        book.setAuthor(author);
        book.setPrice(price);
        book.setType(type);

        BookDao bookDao = new BookDao();
        bookDao.add(book);
    }
}
